cbuffer ConstantBuffer : register( b0 )
{
	matrix World;
	matrix View;
	matrix Projection;
	float4 vLightDir;
	float4 vLightColor;
	float4 vOutputColor;
	float vTime;
}

struct VS_INPUT
{
    float4 Pos : POSITION;
    float3 Norm : NORMAL;
};

struct PS_INPUT
{
    float4 Pos : SV_POSITION;
    float3 Norm : TEXCOORD0;
};

PS_INPUT VS( VS_INPUT input )
{
    PS_INPUT output = (PS_INPUT)0;
    output.Pos = mul( input.Pos, World );
    output.Pos = mul( output.Pos, View );
    output.Pos = mul( output.Pos, Projection );
    output.Norm = mul( float4( input.Norm, 1 ), World ).xyz;
    
    return output;
}

float4 PS(PS_INPUT input) : SV_Target
{
	float4 finalColor = saturate(dot((float3)vLightDir, input.Norm) * vLightColor);
	finalColor.a = 1.0f;
	return finalColor;
}

PS_INPUT VS_Hud(VS_INPUT input)
{
	PS_INPUT output = (PS_INPUT)0;
	output.Pos = input.Pos;
	output.Pos.w = 1.0f;

	if (input.Norm.x > 1.0f)
	{
		output.Pos.x *= 0.8f * abs(sin(vTime * 0.25f)) + 0.15f;
	}

	return output;
}

float4 PS_Hud(PS_INPUT input) : SV_Target
{
	return float4(0.33f, 0.5f, 0.906f, 1.0f);
}

float4 PS_HQ(PS_INPUT input) : SV_Target
{
	return float4(1,0,0,1);
}
